ARG build_img
ARG base_img
FROM ${build_img} as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# Copy the go source
COPY cmd/kubelatte/main.go main.go
COPY pkg/ pkg/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o kubelatte main.go

FROM ${base_img}
WORKDIR /
COPY --from=builder /workspace/kubelatte .
USER 65532:65532

ENTRYPOINT ["/kubelatte"]
